# Contributor: omni <omni+alpine@hack.org>
# Maintainer: omni <omni+alpine@hack.org>
pkgname=tillitis-key1-apps
pkgver=0.0.6
pkgrel=3
pkgdesc="Apps and host programs for TKey, the flexible open hardware/software USB security key"
url="https://www.tillitis.se/"
arch="all !s390x" # s390x lack lld package
license="GPL-2.0-only"
makedepends="go clang llvm lld"
options="!check" # no test suite
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/tillitis/tillitis-key1-apps/archive/refs/tags/v$pkgver.tar.gz
	runsign.sh.patch
	"

build() {
	make
}

package() {
	install -Dm755 -t "$pkgdir/usr/bin" run* tkey-*

	install -Dm644 -t "$pkgdir/usr/lib/udev/rules.d" system/*.rules

	for app in blink nx random rng_stream signer timer; do
		install -Dm644 -t "$pkgdir/usr/share/$pkgname/$app" apps/"$app"/app.bin
	done

	install -Dm644 -t "$pkgdir/usr/share/man/man1" system/tkey-ssh-agent.1
	install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
	install -Dm644 apps/rng_stream/README.md \
		"$pkgdir/usr/share/doc/$pkgname"/rng_stream_app.md
}

sha512sums="
524635270cb8e89a1a542b33899d972c9f3b7699102ebc76251351a973bda7b4e09710fd1d93b4eeaad725b1517b768469b547e8d6ee02ee7e0963f70de77161  tillitis-key1-apps-0.0.6.tar.gz
260b8c636b0244b904b91eafee419d14356b4db6877e1fcdd4b1deda189c1ef93aba8291b8a51282fac39197a5e915caa6d492dfdfebb5a05b822d4d0faa9f25  runsign.sh.patch
"
